import { makeObservable, observable, action } from 'mobx';

class SliderCaptchaStore {
    @observable distance: number;

    @observable clickX: number;

    @observable isEnd: boolean;

    @observable isSuccess: boolean;

    constructor() {
        makeObservable(this);

        this.distance = 0;

        this.clickX = 0;

        this.isEnd = false;

        this.isSuccess = false;
    }

    @action destory: NoneParamsAndReturnFuc = () => {
        this.distance = 0;

        this.clickX = 0;

        this.isEnd = false;

        this.isSuccess = false;
    };

    @action setDistance = (distance: number): void => {
        if (typeof distance === 'number') this.distance = distance;
    };

    @action setClickX = (clickX: number): void => {
        if (typeof clickX === 'number') this.clickX = clickX;
    };

    @action setEnd = (isEnd: boolean): void => {
        if (typeof isEnd === 'boolean') this.isEnd = isEnd;
    };

    @action setSuccess = (isSuccess: boolean): void => {
        if (typeof isSuccess === 'boolean') this.isSuccess = isSuccess;
    };
}

export default SliderCaptchaStore;
